package com.zzt.ioc.component;

import com.zzt.ioc.model.Student;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description
 * User: panda
 * Date: 2025-02-21
 * Time: 18:14
 */
@Component
public class StudentComponent {
    @Bean({"s3","s4"})
//    @Bean(name={"s3","s4"})
//    @Bean(value={"s3","s4"})
    public Student s1(){
        return new Student("zhangsan",11);
    }

    @Bean
    private String name(){
        return "lisi";
    }

    @Bean
    private String name2(){
        return "lisi2";
    }

//    @Bean
//    public Student s2(Student s3){
//        return new Student(s3.getName(),17);
//    }

//    @Primary
    @Bean
    public Student s2(@Qualifier("name") String n){
        return new Student(n,17);
    }


}
